Properly grow plants with growth modifier#8564
Conversation
|
I am opening this as a draft pull request as I'd like more input here before I finalise the system (and hence also ship it to the sugar cane implementation). As @Lulu13022002 pointed out in #8555, while this system works, it will always grow the plant by the base growth at least. This change however means that certain age values are never met in the current implementation. E.g. age 1 and 2 are always completely skipped. So is age 5.
Feedback would be greatly appreciated :) |
f5bbfca to
a0c182a
Compare
|
Sorry for the late reply |
|
There's also another issue when the cactus reach its maximum age (15) it normally creates a new block only in the next random tick however with this pr the new block is created instantly without waiting a new randomtick. That means the cactus grow faster than normal even with the default growth modifier. Another issue is that the last stage (15) is always skipped since it is almost immediately reset to age=0 when a new block grow and so this stage will be unseen in the server. |
a0c182a to
af34a4b
Compare
af34a4b to
68f1f71
Compare
|
This fix would be great, I'm waiting |
Spigots implementation of the growth modifier boils down to a plain chance for a plant to either grow immediately or to grow a single age value towards its fully grown age. This behaviour is specifically troubling for plants like the cactus or the sugar cane, as they change an unrelated block when growing up (the free air block above their tip). This blocks validity is checked during neighbour updated which are triggered by resetting the previous tip of the plant back to [age=0]. With spigots modifier implementation, blocks at the age of zero are able to grow a new block above them however, causing the block change of the previous tip to change a block of age zero to a block of age zero, which does **not** cause a neighbour update as nothing actually changed. This means that the about block is not updated and hence may remain in an otherwise invalid state. (E.g. a cactus block next to a solid block). This commit rewrites the existing spigot growth modifier implementation specifically for the plants that grow new blocks like the cactus or the sugar can block. The modifier provided for the plants is separated into two distinct values. One being the remains after a floored division by 100, e.g. the original modifier without its 10^0 and 10^1 digits, the other the modifier modulo 100. The modifier 475 would, for example, be split into a base growth of 4 and a percentage chance of an additional age progression of 75%. This way, on average, the plant would grow 4.75 times as fast as a normal plant, which would only grow a single age per random tick.
68f1f71 to
9f5bd90
Compare
|
Maybe up this and PR we waiting since 2 years lol |
|
I'm still waiting for this. If it's not going to become master, is there a plugin that can achieve this functionality? Is there a way to hack this into your own private server? I really don't want to move everything over to fabric. |
|
Any eta to add this fix? |
|
Closed in favour of #12264 |
Spigots implementation of the growth modifier boils down to a plain chance for a plant to either grow immediately or to grow a single age value towards its fully grown age.
This behaviour is specifically troubling for plants like the cactus or the sugar cane, as they change an unrelated block when growing up (the free air block above their tip). This blocks validity is checked during neighbour updated which are triggered by resetting the previous tip of the plant back to [age=0].
With spigots modifier implementation, blocks at the age of zero are able to grow a new block above them however, causing the block change of the previous tip to change a block of age zero to a block of age zero, which does not cause a neighbour update as nothing actually changed. This means that the about block is not updated and hence may remain in an otherwise invalid state. (E.g. a cactus block next to a solid block).
This commit rewrites the existing spigot growth modifier implementation specifically for the plants that grow new blocks like the cactus or the sugar can block.
The modifier provided for the plants is separated into two distinct values. One being the remains after a floored division by 100, e.g. the original modifier without its 10^0 and 10^1 digits, the other the modifier modulo 100.
The modifier 475 would, for example, be split into a base growth of 4 and a percentage chance of an additional age progression of 75%. This way, on average, the plant would grow 4.75 times as fast as a normal plant, which would only grow a single age per random tick.
Resolves: #8544